package com.sun.controller;

import com.sun.dao.pojo.params.CommentParam;
import com.sun.dao.vo.Result;
import com.sun.service.CommentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("comments")
public class CommentsController {

    @Autowired
    private CommentsService commentsService;
    @GetMapping ("article/{id}")
    public Result comments(@PathVariable("id") Long id){
        return commentsService.getComByArticleID(id);
    }

    @PostMapping("create/change")
    public Result comment(@RequestBody CommentParam commentParam){
        return commentsService.comment(commentParam);
    }
}
